package top.cyuw.subjectsystem.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.cyuw.subjectsystem.service.SelectionService;
import top.cyuw.subjectsystem.vo.ResponseVo;
import top.cyuw.subjectsystem.vo.selection.SelectionVo;

@RestController
@RequestMapping("/api/selection")
public class SelectionController {

    @Autowired
    SelectionService selectionService;

    @RequestMapping(value = "/finish", method = RequestMethod.GET)
    ResponseVo<Boolean> finish() {
        return ResponseVo.success(selectionService.finish());
    }

    @RequestMapping(value = "/select", method = RequestMethod.GET)
    ResponseVo<SelectionVo> select(@RequestParam Integer subjectId) {
        return ResponseVo.success(selectionService.select(subjectId));
    }

    @RequestMapping(value = "/my", method = RequestMethod.GET)
    ResponseVo<SelectionVo> my() {
        return ResponseVo.success(selectionService.my());
    }

}
